package validator.handle;

import java.lang.annotation.Annotation;

import validator.annotation.NotNull;
import validator.exception.ValidateException;

public class NotNullValidator implements Validator {

	@Override
	public boolean isValid(Class<?> clazz) {
		return clazz instanceof Object;
	}

	@Override
	public void validate(Annotation annotation, Object v) {
		NotNull anno = (NotNull) annotation;
		if (v == null)
			throw new ValidateException(anno.value());
	}

}
